﻿using Gasgoo.DataProvider.EntityFramework.iToolLogger;
using Gasgoo.ShareLibrary.Framework.ServiceDefine;
using iToolLogger.Query.Interface;
using Microsoft.EntityFrameworkCore;

namespace iToolLogger.Query.Service;
public class LoggerOrderService : GasgooServiceBase, ILoggerOrderService
{
    public LoggerOrderService(iToolLoggerContext context)
    {
        Context = context;
    }

    public iToolLoggerContext Context { get; }

    public Task<List<LogFunction>> GetLoggers()
    {
        return this.Context.LogFunctions.ToListAsync();
    }

    public Task<List<LogFunction>> GetLoggers(string keyword)
    {
        return this.Context.LogFunctions.Where(f => f.ResponseBody.Contains(keyword)).ToListAsync();
    }
}
